package com.report.reportserver.controller;

import com.report.reportserver.model.Major;
import com.report.reportserver.service.MajorService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;

import javax.servlet.http.HttpServletRequest;
import java.util.List;

/**
 * @ ClassName: MajorController
 * @ Description：查询专业以及开设学院
 * @ Modified By：
 * @ Version:
 * @ Author     ：LiYing
 * @ Date       ：Created in 16:25 2022/3/29
 */
@Controller
@RequestMapping(value = "/major")
public class MajorController {
    @Autowired
    MajorService majorService;

    @RequestMapping(value = "/id")
    public @ResponseBody
    Major id(Integer id) {
        //int id = Integer.parseInt(request.getParameter("id"));
        return majorService.queryMajorById(id);
    }

    @RequestMapping(value = "/name")
    public @ResponseBody
    Major name(String name) {
        //String name = request.getParameter("name");
        return majorService.queryMajorByName(name);
    }

    @RequestMapping(value = "/academy")
    public @ResponseBody List<Major> academy(String academy) {
        //String academy = request.getParameter("academy");
        return majorService.queryMajorByAcademy(academy);
    }
}
